package com.kuding.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.gson.Gson;
import com.kuding.props.aliyun.AliyunSMSProperty;
import com.kuding.sms.AliyunSmsComponent;

@Configuration
@ConditionalOnProperty(name = "sys.enable-aliyun-sms", havingValue = "true")
@EnableConfigurationProperties({ AliyunSMSProperty.class })
public class AliyunSMSComponentConfig {

	@Autowired
	private AliyunSMSProperty aliyunSMSProperty;

	@Bean
	public AliyunSmsComponent aliyunSmsComponent(Gson gson) {
		AliyunSmsComponent aliyunSmsComponent = new AliyunSmsComponent(gson, aliyunSMSProperty);
		return aliyunSmsComponent;
	}
}
